<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">


<div th:replace="public/base_update :: html"></div>

<body>
<!-- Start Page Loading -->
<div id="loader-wrapper">
    <div id="loader"></div>
    <div class="loader-section section-left"></div>
    <div class="loader-section section-right"></div>
</div>
<!-- End Page Loading -->


<!-- START MAIN -->
<!-- START WRAPPER -->


<!-- START CONTENT -->
<section id="content">
    <!--Form Advance-->
    <div class="row">
        <div class="col s12 m12 l12">
            <div class="card-panel">
                <h4 class="header2">增加用户</h4>
                <div class="row">
                    <form class="col s12" id="send_form" action="">
                        <div class="row">
                            <div class="input-field col s2">
                                <input id="user_id" name="userId" type="text"/>
                                <label for="user_id">用 户 ID</label>
                            </div>
                        </div>
                        <div class="row">
                            <div class="input-field col s2">
                                <input id="user_name" name="username" type="text"/>
                                <label for="user_name">用 户 名</label>
                            </div>
                        </div>
                        <div class="row">
                            <div class="input-field col s2">
                                <input id="password" name="password" type="text"/>
                                <label for="password">密 码</label>
                            </div>
                        </div>
                        <div class="row">
                            <div class="input-field col s2">
                                <input id="user_email" name="email" type="text"/>
                                <label for="user_email">邮 箱</label>
                            </div>
                        </div>
                        <div class="row">
                            <div class="input-field col s2">
                                <input id="user_phone" name="phone" type="text"/>
                                <label for="user_phone">电 话</label>
                            </div>
                        </div>
                        <div class="row">
                            <div class="input-field col s2">
                                <input id="user_sex" name="sex" type="text" />
                                <label for="user_sex">性 别</label>
                            </div>
                        </div>
                        <div class="row">
                            <div class="input-field col s2">
                                <input id="user_age" name="age" type="text"/>
                                <label for="user_age">年 龄</label>
                            </div>
                        </div>
                        <div class="row">
                            <div class="input-field col s12">
                                <button id="send_btn" class="btn cyan waves-effect waves-light right" type="button"
                                        name="action">提交
                                    <i class="mdi-content-send right"></i>
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</section>


<!-- ================================================
Scripts
================================================ -->

<script th:inline="javascript">

    $("#send_btn").click(function () {
        var send_form = $('#send_form').serialize();
        console.log(send_form);
        $.ajax({
            type: "post",
            data: send_form,
            url: "/unitlinforbase/add",
            dataType: "json",
            success: function (msg) {
                if (msg.success) {
                    Materialize.toast(msg.message, 500,'',function () {
                        dialog.parentclose(true)
                    });
                } else {
                    Materialize.toast(msg.message, 3000);
                }
            },
            error: function ( ) {
                Materialize.toast("网络异常");
            }
        });
    });
</script>

</body>

</html>
